package com.skin.admin.manager;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.skin.admin.entity.Goods;
import com.skin.admin.serviceImpl.GoodsServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by Administrator on 2018/8/3 0003.
 */
@Component
public class GoodsManager {

    @Autowired
    private GoodsServiceImpl goodsService;

    public Page<Goods> All(int current , int size){
//        return goodsService.selectPage(new Page<Goods>(current,size),new EntityWrapper<Goods>());
        return goodsService.selectWithFile(new Page<Goods>(current,size));
    }

    public boolean insert(Goods goods){
        return goodsService.insert(goods);
    }

    public Goods findBy(String colum,String name){
        return  goodsService.selectOne(new EntityWrapper<Goods>().eq(colum,name ));
    }

    public boolean deletebyid(String id){
       Goods goods=goodsService.selectById(id);
       if(goods!=null){
           //删除文件

           //删除数据库商品信息
       }
       return true;
    }
}
